﻿'use strict';
import ServicesConfig from './config.js'

export function LoginValidate(userName,passward) {
	var url = ServicesConfig.OSCServiceUrl+'/login_validate';
	let formData = new FormData();
	formData.append('username',userName);
	formData.append('pwd',passward);
	return fetch(url, 
	{
		method: 'POST',
		headers: {
			'Content-Type': 'multipart/form-data',
		},
		body: formData
	});
}

export function OpenidLogin(catalog,openid_info) {
	var url = ServicesConfig.OSCServiceUrl+'/openid_login';
	let formData = new FormData();
	formData.append('catalog',catalog);
	formData.append('openid_info',openid_info);
	return fetch(url, 
	{
		method: 'POST',
		headers: {
			'Content-Type': 'multipart/form-data',
		},
		body: formData
	});
}

export function OpenidRegister(catalog,openid_info) {
	var url = ServicesConfig.OSCServiceUrl+'/openid_reg';
	let formData = new FormData();
	formData.append('catalog',catalog);
	formData.append('openid_info',openid_info);
	return fetch(url, 
	{
		method: 'POST',
		headers: {
			'Content-Type': 'multipart/form-data',
		},
		body: formData
	});
}